﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using WeberTimeTracker.Models;

namespace WeberTimeTracker.Controllers
{
    public class ReportController : Controller
    {
        //
        // GET: /Report/

        public ActionResult Index()
        {
			using (TimeTrackerContext data = new TimeTrackerContext())
			{
				var result = data.Database.SqlQuery<Report_Last_Billing>("[dbo].[report_last_billing] @p0, @p1", "1/1/2012", "1/1/2013").ToList();
				return View(result);
			}
        }


		//
		// GET: /Report/ReportEmployee

		public ActionResult ReportEmployee()
		{
			using (TimeTrackerContext data = new TimeTrackerContext())
			{
				var result = data.Database.SqlQuery<Report_Employee>("[dbo].[report_employee]").ToList();
				return PartialView(result);
			}
		}


		//
		// GET: /Report/ReportPeriod

		public ActionResult ReportPeriod(DateTime fromdate, DateTime todate)
		{
			using (TimeTrackerContext data = new TimeTrackerContext())
			{
				var result = data.Database.SqlQuery<Report_Period>("[dbo].[report_period] @p0, @p1", fromdate, todate).ToList();
				return PartialView(result);
			}
		}


		//
		// GET: /Report/ReportPeriod

		public ActionResult ReportUnpaid()
		{
			using (TimeTrackerContext data = new TimeTrackerContext())
			{
				var result = data.Database.SqlQuery<Report_Unpaid>("[dbo].[report_unpaid]").ToList();
				return PartialView(result);
			}
		}
    }
}
